Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix permissions on default state sub-directories when Agent runs as container #2330

Merged
merged 4 commits into from
Mar 1, 2023

Conversation

ycombinator
Copy link
Contributor

@ycombinator ycombinator commented Feb 28, 2023

What does this PR do?

This PR fixes the permissions of the state/data/tmp and state/data/logs folders when they're setup as part of elastic-agent container running.

Why is it important?

To allow processes within the same group as elastic-agent, e.g. Heartbeat, to write to the state/data/tmp and state/data/logs folders.

Note that there is another folder that's a sibling of those two, state/data/run but it already has the correct permissions, so this PR doesn't do anything with it.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool

Author's Checklist

How to test this PR locally

  1. Rebuild the docker images for Elastic Agent.
  2. Run the docker container for Elastic Agent from the freshly-built image.
  3. Check the paths of sub-folders under /usr/share/elastic-agent/state/data. Verify that all of them are group-writeable.

Related issues

Use cases

Screenshots

Before this PR

Screenshot 2023-02-28 at 10 45 04

After this PR

Screenshot 2023-02-28 at 10 27 06

Logs

@ycombinator ycombinator added >bug backport-v8.7.0 Automated backport with mergify labels Feb 28, 2023
@ycombinator ycombinator requested a review from a team as a code owner February 28, 2023 15:53
@ycombinator ycombinator requested review from AndersonQ and michalpristas and removed request for a team February 28, 2023 15:53
@elasticmachine
Copy link
Contributor

elasticmachine commented Feb 28, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-03-01T08:48:40.968+0000

  • Duration: 21 min 56 sec

Test stats 🧪

Test Results
Failed 0
Passed 4959
Skipped 15
Total 4974

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Contributor

elasticmachine commented Feb 28, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.361% (60/61) 👍
Files 68.9% (144/209) 👍
Classes 68.08% (273/401) 👍
Methods 53.517% (837/1564) 👍
Lines 38.819% (9174/23633) 👎 -0.03
Conditionals 100.0% (0/0) 💚

Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

components should not write any logs since 8.6, agent collects them and they are part of single log file, but i'm ok with the change

@ycombinator ycombinator merged commit e1b4c21 into elastic:main Mar 1, 2023
@ycombinator ycombinator deleted the container-state-dirs-perms branch March 1, 2023 21:01
mergify bot pushed a commit that referenced this pull request Mar 1, 2023
…ontainer (#2330)

* Set temp dir permissions to 0770

* Set logs dir permissions to 0775

* Adding CHANGELOG entry

* Fix kind of change in changelog entry

(cherry picked from commit e1b4c21)
ycombinator added a commit that referenced this pull request Mar 1, 2023
…ontainer (#2330) (#2337)

* Set temp dir permissions to 0770

* Set logs dir permissions to 0775

* Adding CHANGELOG entry

* Fix kind of change in changelog entry

(cherry picked from commit e1b4c21)

Co-authored-by: Shaunak Kashyap <[email protected]>
@cmacknz cmacknz mentioned this pull request Mar 2, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.7.0 Automated backport with mergify >bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Heartbeat] Changes to default beats directories prevent startup
4 participants